{% block sw_product_price_form %}
<div class="sw-product-price-form">
    {% block sw_product_price_form_fields %}
    <sw-container
        columns="1fr 2fr"
        gap="0px 30px"
        class="sw-product-price-form__prices"
    >

        {% block sw_product_price_form_tax_field %}
        <sw-inherit-wrapper
            ref="taxIdInheritation"
            v-model:value="product.taxId"
            :inherited-value="parentProduct.taxId"
            :has-parent="!!parentProduct.taxId"
            :help-text="taxRateHelpText"
            :label="$tc('sw-product.priceForm.labelTaxRate')"
            class="sw-product-price-form__tax-rate"
            required
        >
            <template #content="{ currentValue, updateCurrentValue, isInherited }">
                <mt-select
                    name="sw-field--product-taxId"
                    :placeholder="$tc('sw-product.priceForm.placeholderTaxRate')"
                    validation="required"
                    :disabled="isInherited || !allowEdit || undefined"
                    :model-value="currentValue"
                    :error="productTaxIdError"
                    :options="taxRateOptions"
                    @update:model-value="updateCurrentValue"
                />
            </template>
        </sw-inherit-wrapper>
        {% endblock %}

        {% block sw_product_price_form_price_field %}
        <sw-inherit-wrapper
            v-if="!isLoading"
            v-model:value="prices"
            label=" "
            class="sw-product-price-form__price-list"
            :has-parent="!!parentProduct.id"
            :inherited-value="parentPrices"
            :custom-remove-inheritance-function="removePriceInheritation"
            :custom-inheritation-check-function="inheritationCheckFunction"
        >
            <template #content="{ currentValue, isInherited }">
                <sw-list-price-field
                    vertical
                    :price="currentValue.price"
                    :purchase-prices="currentValue.purchasePrices"
                    :tax-rate="productTaxRate"
                    :disabled="isInherited || !allowEdit || undefined"
                    :error="productPriceError ? productPriceError[0] : null"
                    :currency="defaultCurrency"
                    :show-setting-price="showModeSetting"
                />
            </template>
        </sw-inherit-wrapper>
        {% endblock %}

    </sw-container>
    {% endblock %}

    {% block sw_product_price_form_link %}
    <sw-container
        columns="1fr"
        justify="end"
        class="sw-product-price-form__links"
    >
        {% block sw_product_price_form_advanced_prices_link %}
        <router-link
            v-if="!product._isNew"
            :to="{ name: 'sw.product.detail.prices', params: { id: $route.params.id } }"
            class="sw-card__quick-link"
        >
            {{ $tc('sw-product.detailBase.linkAdvancedPrices') }}
            <mt-icon
                name="regular-long-arrow-right"
                size="16px"
            />
        </router-link>
        {% endblock %}

        {% block sw_product_price_form_maintain_currencies_link %}
        <a
            v-if="product.price"
            class="sw-card__quick-link"
            role="button"
            tabindex="0"
            @click.prevent="displayMaintainCurrencies = true"
            @keydown.enter.prevent="displayMaintainCurrencies = true"
        >
            {{ $tc('sw-product.detailBase.linkMaintainCurrencyPrices') }}
            <mt-icon
                name="regular-long-arrow-right"
                size="16px"
            />
        </a>
        {% endblock %}
    </sw-container>
    {% endblock %}

    {% block sw_product_price_form_maintain_currencies_modal %}
    <sw-maintain-currencies-modal
        v-if="displayMaintainCurrencies"
        variant="full"
        :currencies="currencies"
        :prices="product.price"
        :default-price="defaultPrice"
        :tax-rate="productTaxRate"
        :disabled="!allowEdit || undefined"
        @modal-close="onMaintainCurrenciesClose"
        @update-prices="updatePrices"
    />
    {% endblock %}
</div>
{% endblock %}
